<template>
  <el-dialog width="100%" title="配货出库单审批" :visible.sync="dialogFormVisible" @open="dkbj()" center>
    <div class="biaodan clearfix">
      <el-form :model="form" :inline="true" class="form" label-width="80px" ref="form">
        <el-form-item label="商品类型:" prop="typeName" :disabled="true">
          <el-input
            style="width: 200px"
            v-model="form.typeName"
            placeholder="请选择商品类型"
            :disabled="true"
          ></el-input>
        </el-form-item>
        <el-form-item label="出库门店:" prop="suoshucorp">
          <el-input style="width: 200px" v-model="form.suoshucorp" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="出库类库:" prop="guitainame">
          <el-input style="width: 200px" v-model="form.guitainame" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="创单日期:" prop="createtime">
          <el-input style="width: 200px" v-model="form.createtime" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="订单号:" prop="orderid">
          <el-input style="width: 200px" v-model="form.orderid" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="入库门店:" prop="fendianname">
          <el-input style="width: 200px" v-model="form.fendianname" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="入库柜台:" prop="guitainame">
          <el-input style="width: 200px" v-model="form.guitainame" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="单据编号:" prop="documentid">
          <el-input style="width: 200px" v-model="form.documentid" :disabled="true"></el-input>
        </el-form-item>
      </el-form>
      <div class="anniu">
        <el-button class="shtg" type="success" @click="shengHeTongGuo('form')">审核通过</el-button>
        <el-button class="shbh" type="danger" @click="shengHeBoHui('form')">审核驳回</el-button>
      </div>
    </div>
    <el-table :data="tableData" :cell-style="rowStyle" :header-cell-style="headStyle" border style="width: 100%">
      <el-table-column width="100px" prop="hh" label="行号" type="index"> </el-table-column>
      <el-table-column width="100px" prop="goodsCode" label="商品编码"> </el-table-column>
      <el-table-column width="100px" prop="111111111" label="商品名称"> </el-table-column>
      <el-table-column width="100px" prop="modlNum" label="模具号"> </el-table-column>
      <el-table-column width="100px" prop="certificateNum" label="证书号"> </el-table-column>
      <el-table-column width="100px" prop="goldComtent" label="含金量"> </el-table-column>
      <el-table-column width="100px" prop="count" label="数量"> </el-table-column>
      <el-table-column width="100px" prop="111111111" label="单件重"> </el-table-column>
      <el-table-column width="100px" prop="totalWeight" label="重量"> </el-table-column>
      <el-table-column width="100px" prop="111111111111" label="金重"> </el-table-column>
      <el-table-column width="100px" prop="mainStoneHeavy" label="主石重"> </el-table-column>
      <el-table-column width="100px" prop="viceStoneHeavy" label="副石重"> </el-table-column>
      <el-table-column width="100px" prop="111111111" label="料价"> </el-table-column>
      <el-table-column width="100px" prop="111111111" label="工费"> </el-table-column>
      <el-table-column width="100px" prop="111111111" label="真实成本"> </el-table-column>
      <el-table-column width="100px" prop="costUnitPrice" label="成本单价"> </el-table-column>
      <el-table-column width="100px" prop="totalPrice" label="总成本"> </el-table-column>
      <el-table-column width="100px" prop="11111111111" label="标签价"> </el-table-column>
      <el-table-column width="100px" prop="ringSize" label="手寸"> </el-table-column>
      <el-table-column label="操作" width="280px" fixed="right">
        <template slot-scope="scope">
          <el-button size="mini" type="warning" @click="handleEdit(scope.$index, scope.row)">商品详情(编辑)</el-button>
          <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
import { UpdateDoosApi } from '@/http/doos.js'
export default {
  name: 'handleUpdate',
  data() {
    return {
      dialogFormVisible: false,
      form: {
        typeName: '', //商品类型
        suoshucorp: '', //出库门店
        guitainame: '', //出库类库
        createtime: '', //创单日期
        orderid: '', //订单号
        fendianname: '', //入库门店
        // guitainame: '', //出库柜台
        documentid: '' //单据编号
      },
      tableData: []
    }
  },
  created() {
    this.$bus.$on('sh', (bool, ssh) => {
      this.dialogFormVisible = bool
      this.form = ssh[0]
    })
  },
  methods: {
    shengHeBoHui(from) {
      this.form.state = 1
      UpdateDoosApi(this.form)
        .then(() => {
          this.dialogFormVisible = false
          this.$refs[from].resetFields()
          this.$message({
            message: '操作成功',
            type: 'success'
          })
        })
        .catch(() => {
          this.$message({
            message: '操作失败',
            type: 'error'
          })
        })
    },
    dkbj() {
      this.dialogFormVisible = true
    },
    rowStyle() {
      return 'text-align:center'
    },
    headStyle() {
      return 'text-align:center'
    },
    shengHeTongGuo(formName) {
      this.form.state = 2
      UpdateDoosApi(this.form)
        .then(() => {
          this.dialogFormVisible = false
          this.$refs[formName].resetFields()
          this.$message({
            message: '操作成功',
            type: 'success'
          })
        })
        .catch(() => {
          this.$message({
            message: '操作失败',
            type: 'error'
          })
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.biaodan {
  .form {
    padding: 0 50px;
    width: 70%;
    float: left;
  }
  .anniu {
    width: 30%;
    float: left;
    .shtg,
    .shbh {
      height: 80px;
      margin: 20px 0 0 40px;
    }
  }
}
</style>